home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / SoundInput.a < prev    next >
Encoding:
Text File  |  1996-05-29  |  11.8 KB  |  481 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        SoundInput.a
  3. ;
  4. ;    Contains:    Sound Input Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2.1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__SOUNDINPUT__') = 'UNDEFINED' THEN
  21. __SOUNDINPUT__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  30.     include 'AppleEvents.a'
  31.     ENDIF
  32. ;        include 'Errors.a'                                            ;
  33. ;        include 'Memory.a'                                            ;
  34. ;            include 'MixedMode.a'                                    ;
  35. ;        include 'OSUtils.a'                                            ;
  36. ;        include 'Events.a'                                            ;
  37. ;            include 'Quickdraw.a'                                    ;
  38. ;                include 'QuickdrawText.a'                            ;
  39. ;        include 'EPPC.a'                                            ;
  40. ;            include 'AppleTalk.a'                                    ;
  41. ;            include 'Files.a'                                        ;
  42. ;                include 'Finder.a'                                    ;
  43. ;            include 'PPCToolbox.a'                                    ;
  44. ;            include 'Processes.a'                                    ;
  45. ;        include 'Notification.a'                                    ;
  46.  
  47.     IF &TYPE('__WINDOWS__') = 'UNDEFINED' THEN
  48.     include 'Windows.a'
  49.     ENDIF
  50. ;        include 'Controls.a'                                        ;
  51. ;            include 'Menus.a'                                        ;
  52.  
  53.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  54.     include 'Dialogs.a'
  55.     ENDIF
  56. ;        include 'TextEdit.a'                                        ;
  57.  
  58.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  59.     include 'Files.a'
  60.     ENDIF
  61.  
  62.     IF &TYPE('__SOUND__') = 'UNDEFINED' THEN
  63.     include 'Sound.a'
  64.     ENDIF
  65. ;        include 'Components.a'                                        ;
  66.  
  67. ;
  68. ;                        * * *  N O T E  * * *
  69. ;
  70. ;    This file has been updated to include Sound Input Manager 1.1 interfaces.
  71. ;
  72. ;    Some of the Sound Input Manager 1.1 interfaces were not put into the InterfaceLib
  73. ;    that originally shipped with the PowerMacs. These missing functions and the
  74. ;    new 1.1 interfaces have been released in the SoundLib library for PowerPC
  75. ;    developers to link with. The runtime library for these functions are
  76. ;    installed by Sound Manager 3.2. The following functions are found in SoundLib.
  77. ;
  78. ;        ParseAIFFHeader(), ParseSndHeader()
  79. ;
  80. ;
  81.  
  82. siDeviceIsConnected                EQU        1                    ;input device is connected and ready for input
  83. siDeviceNotConnected            EQU        0                    ;input device is not connected
  84. siDontKnowIfConnected            EQU        -1                    ;can't tell if input device is connected
  85. siReadPermission                EQU        0                    ;permission passed to SPBOpenDevice
  86. siWritePermission                EQU        1                    ;permission passed to SPBOpenDevice
  87.  
  88. ;Info Selectors for Sound Input Drivers
  89. siActiveChannels                EQU        'chac'                ;active channels
  90. siActiveLevels                    EQU        'lmac'                ;active meter levels
  91. siAGCOnOff                        EQU        'agc '                ;automatic gain control state
  92. siAsync                            EQU        'asyn'                ;asynchronous capability
  93. siChannelAvailable                EQU        'chav'                ;number of channels available
  94. siCompressionAvailable            EQU        'cmav'                ;compression types available
  95. siCompressionFactor                EQU        'cmfa'                ;current compression factor
  96. siCompressionHeader                EQU        'cmhd'                ;return compression header
  97. siCompressionNames                EQU        'cnam'                ;compression type names available
  98. siCompressionType                EQU        'comp'                ;current compression type
  99. siContinuous                    EQU        'cont'                ;continous recording
  100. siDeviceBufferInfo                EQU        'dbin'                ;size of interrupt buffer
  101. siDeviceConnected                EQU        'dcon'                ;input device connection status
  102. siDeviceIcon                    EQU        'icon'                ;input device icon
  103. siDeviceName                    EQU        'name'                ;input device name
  104. siHardwareBusy                    EQU        'hwbs'                ;sound hardware is in use
  105. siInputGain                        EQU        'gain'                ;input gain
  106. siInputSource                    EQU        'sour'                ;input source selector
  107. siInputSourceNames                EQU        'snam'                ;input source names
  108. siLevelMeterOnOff                EQU        'lmet'                ;level meter state
  109. siModemGain                        EQU        'mgai'                ;modem input gain
  110. siNumberChannels                EQU        'chan'                ;current number of channels
  111. siOptionsDialog                    EQU        'optd'                ;display options dialog
  112. siPlayThruOnOff                    EQU        'plth'                ;playthrough state
  113. siRecordingQuality                EQU        'qual'                ;recording quality
  114. siSampleRate                    EQU        'srat'                ;current sample rate
  115. siSampleRateAvailable            EQU        'srav'                ;sample rates available
  116. siSampleSize                    EQU        'ssiz'                ;current sample size
  117. siSampleSizeAvailable            EQU        'ssav'                ;sample sizes available
  118. siSetupCDAudio                    EQU        'sucd'                ;setup sound hardware for CD audio
  119. siSetupModemAudio                EQU        'sumd'                ;setup sound hardware for modem audio
  120. siStereoInputGain                EQU        'sgai'                ;stereo input gain
  121. siTwosComplementOnOff            EQU        'twos'                ;two's complement state
  122. siVoxRecordInfo                    EQU        'voxr'                ;VOX record parameters
  123. siVoxStopInfo                    EQU        'voxs'                ;VOX stop parameters
  124. siCloseDriver                    EQU        'clos'                ;reserved for internal use only
  125. siInitializeDriver                EQU        'init'                ;reserved for internal use only
  126. siPauseRecording                EQU        'paus'                ;reserved for internal use only
  127. siUserInterruptProc                EQU        'user'                ;reserved for internal use only
  128. ;Qualities
  129. siCDQuality                        EQU        'cd  '                ;44.1kHz, stereo, 16 bit
  130. siBestQuality                    EQU        'best'                ;22kHz, mono, 8 bit
  131. siBetterQuality                    EQU        'betr'                ;22kHz, mono, MACE 3:1
  132. siGoodQuality                    EQU        'good'                ;22kHz, mono, MACE 6:1
  133.  
  134. ; typedef struct SPB         SPB, *SPBPtr
  135. ;user procedures called by sound input routines
  136. SPB                     RECORD    0
  137. inRefNum                 ds.l   1        ; offset: $0 (0)        ;reference number of sound input device
  138. count                     ds.l   1        ; offset: $4 (4)        ;number of bytes to record
  139. milliseconds             ds.l   1        ; offset: $8 (8)        ;number of milliseconds to record
  140. bufferLength             ds.l   1        ; offset: $C (12)        ;length of buffer in bytes
  141. bufferPtr                 ds.l   1        ; offset: $10 (16)        ;buffer to store sound data in
  142. completionRoutine         ds.l   1        ; offset: $14 (20)        ;completion routine
  143. interruptRoutine         ds.l   1        ; offset: $18 (24)        ;interrupt routine
  144. userLong                 ds.l   1        ; offset: $1C (28)        ;user-defined field
  145. error                     ds.w   1        ; offset: $20 (32)        ;error
  146. unused1                     ds.l   1        ; offset: $22 (34)        ;reserved - must be zero
  147. sizeof                     EQU *            ; size:   $26 (38)
  148.                         ENDR
  149.  
  150. ;
  151. ; pascal NumVersion SPBVersion(void)
  152. ;
  153.     IF ¬ GENERATINGCFM THEN
  154.         Macro
  155.         _SPBVersion
  156.             dc.w     $203C
  157.             dc.w     $0000
  158.             dc.w     $0014
  159.             dc.w     $A800
  160.         EndM
  161.     ELSE
  162.         IMPORT_CFM_FUNCTION    SPBVersion
  163.     ENDIF
  164.  
  165. ;
  166. ; pascal OSErr SndRecord(ModalFilterUPP filterProc, Point corner, OSType quality, SndListHandle *sndHandle)
  167. ;
  168.     IF ¬ GENERATINGCFM THEN
  169.         Macro
  170.         _SndRecord
  171.             dc.w     $203C
  172.             dc.w     $0804
  173.             dc.w     $0014
  174.             dc.w     $A800
  175.         EndM
  176.     ELSE
  177.         IMPORT_CFM_FUNCTION    SndRecord
  178.     ENDIF
  179.  
  180. ;
  181. ; pascal OSErr SndRecordToFile(ModalFilterUPP filterProc, Point corner, OSType quality, short fRefNum)
  182. ;
  183.     IF ¬ GENERATINGCFM THEN
  184.         Macro
  185.         _SndRecordToFile
  186.             dc.w     $203C
  187.             dc.w     $0708
  188.             dc.w     $0014
  189.             dc.w     $A800
  190.         EndM
  191.     ELSE
  192.         IMPORT_CFM_FUNCTION    SndRecordToFile
  193.     ENDIF
  194.  
  195. ;
  196. ; pascal OSErr SPBSignInDevice(short deviceRefNum, ConstStr255Param deviceName)
  197. ;
  198.     IF ¬ GENERATINGCFM THEN
  199.         Macro
  200.         _SPBSignInDevice
  201.             dc.w     $203C
  202.             dc.w     $030C
  203.             dc.w     $0014
  204.             dc.w     $A800
  205.         EndM
  206.     ELSE
  207.         IMPORT_CFM_FUNCTION    SPBSignInDevice
  208.     ENDIF
  209.  
  210. ;
  211. ; pascal OSErr SPBSignOutDevice(short deviceRefNum)
  212. ;
  213.     IF ¬ GENERATINGCFM THEN
  214.         Macro
  215.         _SPBSignOutDevice
  216.             dc.w     $203C
  217.             dc.w     $0110
  218.             dc.w     $0014
  219.             dc.w     $A800
  220.         EndM
  221.     ELSE
  222.         IMPORT_CFM_FUNCTION    SPBSignOutDevice
  223.     ENDIF
  224.  
  225. ;
  226. ; pascal OSErr SPBGetIndexedDevice(short count, Str255 deviceName, Handle *deviceIconHandle)
  227. ;
  228.     IF ¬ GENERATINGCFM THEN
  229.         Macro
  230.         _SPBGetIndexedDevice
  231.             dc.w     $203C
  232.             dc.w     $0514
  233.             dc.w     $0014
  234.             dc.w     $A800
  235.         EndM
  236.     ELSE
  237.         IMPORT_CFM_FUNCTION    SPBGetIndexedDevice
  238.     ENDIF
  239.  
  240. ;
  241. ; pascal OSErr SPBOpenDevice(ConstStr255Param deviceName, short permission, long *inRefNum)
  242. ;
  243.     IF ¬ GENERATINGCFM THEN
  244.         Macro
  245.         _SPBOpenDevice
  246.             dc.w     $203C
  247.             dc.w     $0518
  248.             dc.w     $0014
  249.             dc.w     $A800
  250.         EndM
  251.     ELSE
  252.         IMPORT_CFM_FUNCTION    SPBOpenDevice
  253.     ENDIF
  254.  
  255. ;
  256. ; pascal OSErr SPBCloseDevice(long inRefNum)
  257. ;
  258.     IF ¬ GENERATINGCFM THEN
  259.         Macro
  260.         _SPBCloseDevice
  261.             dc.w     $203C
  262.             dc.w     $021C
  263.             dc.w     $0014
  264.             dc.w     $A800
  265.         EndM
  266.     ELSE
  267.         IMPORT_CFM_FUNCTION    SPBCloseDevice
  268.     ENDIF
  269.  
  270. ;
  271. ; pascal OSErr SPBRecord(SPBPtr inParamPtr, Boolean asynchFlag)
  272. ;
  273.     IF ¬ GENERATINGCFM THEN
  274.         Macro
  275.         _SPBRecord
  276.             dc.w     $203C
  277.             dc.w     $0320
  278.             dc.w     $0014
  279.             dc.w     $A800
  280.         EndM
  281.     ELSE
  282.         IMPORT_CFM_FUNCTION    SPBRecord
  283.     ENDIF
  284.  
  285. ;
  286. ; pascal OSErr SPBRecordToFile(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag)
  287. ;
  288.     IF ¬ GENERATINGCFM THEN
  289.         Macro
  290.         _SPBRecordToFile
  291.             dc.w     $203C
  292.             dc.w     $0424
  293.             dc.w     $0014
  294.             dc.w     $A800
  295.         EndM
  296.     ELSE
  297.         IMPORT_CFM_FUNCTION    SPBRecordToFile
  298.     ENDIF
  299.  
  300. ;
  301. ; pascal OSErr SPBPauseRecording(long inRefNum)
  302. ;
  303.     IF ¬ GENERATINGCFM THEN
  304.         Macro
  305.         _SPBPauseRecording
  306.             dc.w     $203C
  307.             dc.w     $0228
  308.             dc.w     $0014
  309.             dc.w     $A800
  310.         EndM
  311.     ELSE
  312.         IMPORT_CFM_FUNCTION    SPBPauseRecording
  313.     ENDIF
  314.  
  315. ;
  316. ; pascal OSErr SPBResumeRecording(long inRefNum)
  317. ;
  318.     IF ¬ GENERATINGCFM THEN
  319.         Macro
  320.         _SPBResumeRecording
  321.             dc.w     $203C
  322.             dc.w     $022C
  323.             dc.w     $0014
  324.             dc.w     $A800
  325.         EndM
  326.     ELSE
  327.         IMPORT_CFM_FUNCTION    SPBResumeRecording
  328.     ENDIF
  329.  
  330. ;
  331. ; pascal OSErr SPBStopRecording(long inRefNum)
  332. ;
  333.     IF ¬ GENERATINGCFM THEN
  334.         Macro
  335.         _SPBStopRecording
  336.             dc.w     $203C
  337.             dc.w     $0230
  338.             dc.w     $0014
  339.             dc.w     $A800
  340.         EndM
  341.     ELSE
  342.         IMPORT_CFM_FUNCTION    SPBStopRecording
  343.     ENDIF
  344.  
  345. ;
  346. ; pascal OSErr SPBGetRecordingStatus(long inRefNum, short *recordingStatus, short *meterLevel, unsigned long *totalSamplesToRecord, unsigned long *numberOfSamplesRecorded, unsigned long *totalMsecsToRecord, unsigned long *numberOfMsecsRecorded)
  347. ;
  348.     IF ¬ GENERATINGCFM THEN
  349.         Macro
  350.         _SPBGetRecordingStatus
  351.             dc.w     $203C
  352.             dc.w     $0E34
  353.             dc.w     $0014
  354.             dc.w     $A800
  355.         EndM
  356.     ELSE
  357.         IMPORT_CFM_FUNCTION    SPBGetRecordingStatus
  358.     ENDIF
  359.  
  360. ;
  361. ; pascal OSErr SPBGetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  362. ;
  363.     IF ¬ GENERATINGCFM THEN
  364.         Macro
  365.         _SPBGetDeviceInfo
  366.             dc.w     $203C
  367.             dc.w     $0638
  368.             dc.w     $0014
  369.             dc.w     $A800
  370.         EndM
  371.     ELSE
  372.         IMPORT_CFM_FUNCTION    SPBGetDeviceInfo
  373.     ENDIF
  374.  
  375. ;
  376. ; pascal OSErr SPBSetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  377. ;
  378.     IF ¬ GENERATINGCFM THEN
  379.         Macro
  380.         _SPBSetDeviceInfo
  381.             dc.w     $203C
  382.             dc.w     $063C
  383.             dc.w     $0014
  384.             dc.w     $A800
  385.         EndM
  386.     ELSE
  387.         IMPORT_CFM_FUNCTION    SPBSetDeviceInfo
  388.     ENDIF
  389.  
  390. ;
  391. ; pascal OSErr SPBMillisecondsToBytes(long inRefNum, long *milliseconds)
  392. ;
  393.     IF ¬ GENERATINGCFM THEN
  394.         Macro
  395.         _SPBMillisecondsToBytes
  396.             dc.w     $203C
  397.             dc.w     $0440
  398.             dc.w     $0014
  399.             dc.w     $A800
  400.         EndM
  401.     ELSE
  402.         IMPORT_CFM_FUNCTION    SPBMillisecondsToBytes
  403.     ENDIF
  404.  
  405. ;
  406. ; pascal OSErr SPBBytesToMilliseconds(long inRefNum, long *byteCount)
  407. ;
  408.     IF ¬ GENERATINGCFM THEN
  409.         Macro
  410.         _SPBBytesToMilliseconds
  411.             dc.w     $203C
  412.             dc.w     $0444
  413.             dc.w     $0014
  414.             dc.w     $A800
  415.         EndM
  416.     ELSE
  417.         IMPORT_CFM_FUNCTION    SPBBytesToMilliseconds
  418.     ENDIF
  419.  
  420. ;
  421. ; pascal OSErr SetupSndHeader(SndListHandle sndHandle, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, short baseNote, unsigned long numBytes, short *headerLen)
  422. ;
  423.     IF ¬ GENERATINGCFM THEN
  424.         Macro
  425.         _SetupSndHeader
  426.             dc.w     $203C
  427.             dc.w     $0D48
  428.             dc.w     $0014
  429.             dc.w     $A800
  430.         EndM
  431.     ELSE
  432.         IMPORT_CFM_FUNCTION    SetupSndHeader
  433.     ENDIF
  434.  
  435. ;
  436. ; pascal OSErr SetupAIFFHeader(short fRefNum, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, unsigned long numBytes, unsigned long numFrames)
  437. ;
  438.     IF ¬ GENERATINGCFM THEN
  439.         Macro
  440.         _SetupAIFFHeader
  441.             dc.w     $203C
  442.             dc.w     $0B4C
  443.             dc.w     $0014
  444.             dc.w     $A800
  445.         EndM
  446.     ELSE
  447.         IMPORT_CFM_FUNCTION    SetupAIFFHeader
  448.     ENDIF
  449.  
  450. ;  Sound Input Manager 1.1 and later calls 
  451. ;
  452. ; pascal OSErr ParseAIFFHeader(short fRefNum, SoundComponentData *sndInfo, unsigned long *numFrames, unsigned long *dataOffset)
  453. ;
  454.     IF ¬ GENERATINGCFM THEN
  455.         Macro
  456.         _ParseAIFFHeader
  457.             dc.w     $203C
  458.             dc.w     $0758
  459.             dc.w     $0014
  460.             dc.w    $A800
  461.         EndM
  462.     ELSE
  463.         IMPORT_CFM_FUNCTION ParseAIFFHeader
  464.     ENDIF
  465.  
  466. ;
  467. ; pascal OSErr ParseSndHeader(SndListHandle sndHandle, SoundComponentData *sndInfo, unsigned long *numFrames, unsigned long *dataOffset)
  468. ;
  469.     IF ¬ GENERATINGCFM THEN
  470.         Macro
  471.         _ParseSndHeader
  472.             dc.w     $203C
  473.             dc.w     $085C
  474.             dc.w     $0014
  475.             dc.w    $A800
  476.         EndM
  477.     ELSE
  478.         IMPORT_CFM_FUNCTION ParseSndHeader
  479.     ENDIF
  480.     ENDIF ; __SOUNDINPUT__
  481.